﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class EditPara : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        return;
        if (!IsPostBack)
            BindPara();
    }
    protected void grvFeeInfo_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
    {
        if (this.grvFeeInfo.EditIndex >= 0)
        {
            this.grvFeeInfo.EditIndex = -1;
            BindPara();
        }
    }
    protected void grvFeeInfo_RowEditing(object sender, GridViewEditEventArgs e)
    {
        this.grvFeeInfo.EditIndex = e.NewEditIndex;
        BindPara();
    }
    private void BindPara()
    {
        Bussiness.ThermaltestPara Para = new Bussiness.ThermaltestPara();
        DataTable dt = Para.GetEditPara("TRUE");
        this.grvFeeInfo.DataSource = dt;
        this.grvFeeInfo.DataBind();
    }
    protected void grvFeeInfo_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        if (this.grvFeeInfo.EditIndex >= 0)
        {
            int ID_KEY = Convert.ToInt32(this.grvFeeInfo.DataKeys[e.RowIndex].Value);

            TextBox calBox = this.grvFeeInfo.Rows[e.RowIndex].Cells[5].Controls[0] as TextBox;
            string formula = calBox.Text;

            Bussiness.ThermaltestPara Para = new Bussiness.ThermaltestPara();
            Para.Edit(ID_KEY, formula);

            this.grvFeeInfo.EditIndex = -1;
            BindPara();
        }
    }
}
